import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class Chapter1Page extends HomePage {

    @FindBy(xpath = "//*")
    private WebElement chapterPage;

    @FindBy(xpath = "//a[text() = 'Home Page']")
    private WebElement homePage;

    public Chapter1Page(WebDriver driver) {
        super(driver);
    }

    public void clickOnHomePage() {
        clickOn(homePage);
    }

    public boolean isTextOnPage(String text) {
        LOG.info("Expected text is '" + text + "'");
        String textOnPage = chapterPage.getText();
        return textOnPage.contains(text);
    }
}
